package com.bestcem.xm.qdes.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bestcem.xm.component.mybatis.base.BaseEntity;
import com.bestcem.xm.component.mybatis.format.String2JacksonSerializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "ds_qdes_project")
public class QdesProject extends BaseEntity {

    @TableId(value = "id")
    private String id;

    /**
     * 问卷编号
     */
    @TableField(value = "code")
    private String code;

    /**
     * 问卷标题
     */
    @TableField(value = "title")
    private String title;

    /**
     * 问卷创建人
     */
    @TableField(value = "creator")
    private String creator;

    /**
     * 所属公司ID
     */
    @TableField(value = "company_id")
    @JsonProperty("companyID")
    //@JSONField(name = "companyID")
    private String companyId;

    /**
     * 问卷所属组和祖先组
     */
    @TableField(value = "group_list")
    @JsonSerialize(using = String2JacksonSerializer.class)
    //@JSONField(serializeUsing = StringValue2FastJsonSerializer.class)
    private String groupList;

    //适配MapStruct弄了个冗余字段
    @TableField(exist = false)
    @JsonIgnore
    private List<String> groupListList;

    /**
     * 问卷版本号
     */
    @TableField(value = "version")
    private Integer version;

    /**
     * 当前发布版本号
     */
    @TableField(value = "release_ver")
    private Integer releaseVer;

    /**
     * 问卷状态
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 问卷结构数据ID
     */
    @TableField(value = "struct_id")
    @JsonProperty("structID")
    //@JSONField(name = "structID")
    private String structId;

    /**
     * 问卷逻辑数据ID
     */
    @TableField(value = "logic_id")
    @JsonProperty("logicID")
    //@JSONField(name = "logicID")
    private String logicId;

    /**
     * 问卷自定义属性
     */
    @TableField(value = "custom_attr")
    @JsonProperty("customAttr")
    @JsonSerialize(using = String2JacksonSerializer.class)
    //@JSONField(name = "customAttr", serializeUsing = StringValue2FastJsonSerializer.class)
    private String customAttr;

    /**
     * 外部来源
     */
    @TableField(value = "source")
    private String source;

    /**
     * 外部问卷ID
     */
    @TableField(value = "ext_id")
    @JsonProperty("extID")
    //@JSONField(name = "extID")
    private String extId;

    /**
     * 问卷状态定时修改时间
     */
    @TableField(value = "timer_expire")
    @JsonProperty("timer_expire")
    //@JSONField(name = "timer_expire")
    private Integer timerExpire;

    /**
     * 问卷类型
     */
    @TableField(value = "ptype")
    private Integer ptype;

    /**
     * 是否是从sample 拷贝的示例项目
     */
    @TableField(value = "is_copy_demo")
    @JsonProperty("is_copy_demo")
    //@JSONField(name = "is_copy_demo")
    private Boolean isCopyDemo;

    /**
     * 记录项目在BI模块中的一些信息，供查询BI统计数据使用key
     */
    @TableField(value = "worktable_info")
    @JsonProperty("worktable_info")
    @JsonSerialize(using = String2JacksonSerializer.class)
    //@JSONField(name = "worktable_info", serializeUsing = StringValue2FastJsonSerializer.class)
    private String worktableInfo;

    @TableField(exist = false)
    @JsonSerialize(using = String2JacksonSerializer.class)
    //@JSONField(serializeUsing = StringValue2FastJsonSerializer.class)
    private String qstruct;
}
